/*
 * @Author: Shane
 * @Date: 2022-07-01 15:55:53
 * @LastEditTime: 2022-07-20 14:56:35
 * @LastEditors: Shane
 * @Description: 
 * @FilePath: /app-framework/common_widgets/lib/app_bar/app_bar_base.dart
 */

import 'package:flutter/material.dart';

class KKSliverAppBar extends SliverAppBar {
  KKSliverAppBar(
    BuildContext context,
    String title, {
    Key? key,
    TextStyle titleTextStyle = const TextStyle(
      color: Color(0xFF303133),
      fontSize: 16,
      fontWeight: FontWeight.bold,
    ),
    Color? backgroundColor,
    Color? foregroundColor,
    double? elevation,
    Brightness? brightness,
    Widget? leading,
    double leadingWidth = 56,
    double? titleSpacing,
    Color? shadowColor,
    double? scrolledUnderElevation,
    Widget? flexibleSpace,
    double? collapsedHeight,
    double? expandedHeight,
    IconThemeData? iconTheme,
    IconThemeData? actionsIconTheme,
    List<Widget>? actions,
    PreferredSizeWidget? bottom,
    bool floating = false,
    bool pinned = false,
    bool snap = false,
    bool stretch = false,
    double stretchTriggerOffset = 100.0,
    ShapeBorder? shape,
    bool centerTitle = true,
    Function()? onTapCallback,
  }) : super(
          key: key,
          title: Text(title, style: titleTextStyle),
          centerTitle: centerTitle,
          leadingWidth: leadingWidth,
          titleSpacing: titleSpacing,
          backgroundColor: backgroundColor ?? Colors.white,
          foregroundColor: foregroundColor,
          elevation: elevation ?? 0,
          scrolledUnderElevation: scrolledUnderElevation,
          shadowColor: shadowColor,
          flexibleSpace: flexibleSpace,
          collapsedHeight: collapsedHeight,
          expandedHeight: expandedHeight,
          iconTheme: iconTheme,
          actionsIconTheme: actionsIconTheme,
          actions: actions,
          bottom: bottom,
          stretchTriggerOffset: stretchTriggerOffset,
          shape: shape,
          floating: floating,
          pinned: pinned,
          snap: snap,
          stretch: stretch,
          leading: leading ??
              IconButton(
                  onPressed: onTapCallback ??
                      () {
                        Navigator.of(context).pop();
                      },
                  icon: const Icon(
                    Icons.arrow_back_ios,
                    color: Color(0xFF909399),
                  )),
        );
}
